#include <REGX52.H>

void Delay1ms(unsigned int xms)		//@11.0592MHz
{
	unsigned char i, j;

	while(xms--)
	{
		i = 2;
		j = 199;
		do
		{
			while (--j);
		} while (--i);
	}

}


void main()
{
	unsigned int i = 0;
	unsigned int a = 1;
	while(1)
	{
		for(i = 0; i < 8; i++)
		{
			a = ~(1<<i);
			P2 = a;
			Delay1ms(500);
			if(P2 == 0)
			{
				a = 1;
			}
		}
	}
}